import types from '../mutations-types'
import { ActionTree, MutationTree, GetterTree } from 'vuex'
import { GlobalState } from './types/types'
import { RootState } from '../types'
import { login } from '../../api/login'
const namespaced: boolean = true
const state: GlobalState = {
  version: '1.0.0',
  token: '',
  user: '111'
}

const mutations: MutationTree<any> = {
  [types.SHOW_LOADING] (state: GlobalState, payload: string): void {
    state.user = payload
  }
}
const getters: GetterTree<GlobalState, RootState> = {
  getUser (state: GlobalState): string {
    return state.user
  }
}

const actions: ActionTree<any, any> = {
  async login({commit}, payload) {
    console.log('尝试登录')
    login("")
    
    //commit(types.SHOW_LOADING, payload)

  }
}

export default {
  namespaced,
  state,
  mutations,
  actions,
  getters
}
